package com.gxa.community.core.pojo.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 *
 * @author juran
 * @since 2022-07-19
 */
@Data
@AllArgsConstructor
@Accessors(chain = true)
@TableName("admin")
@ApiModel(value = "Admin对象", description = "管理员表")
@Validated
public class Admin implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("自增id")
      @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("登录账号")
    @NotEmpty(message = "账号不能为空")
    private String loginAct;

    @ApiModelProperty("姓名")
    @NotEmpty(message = "姓名不能为空")
    private String nick;

    @ApiModelProperty("密码")
    @NotEmpty(message = "密码不能为空")
    private String password;

    @ApiModelProperty("盐")
    private String salt;

    @ApiModelProperty("手机号")
    @Pattern(regexp ="^[1](([3][0-9])|([4][5,7,9])|([5][0-9])|([6][6])|([7][3,5,6,7,8])|([8][0-9])|([9][8,9]))[0-9]{8}$",message = "手机格式不正确")
    private String phone;

    @ApiModelProperty("创建时间")
    private Long createTime;

    @ApiModelProperty("角色id")
    private Integer roleId;

    @ApiModelProperty("登录状态")
    private Integer loginStatus;
}
